package org.springblade.modules.admin.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springblade.modules.admin.vo.TaskStatusVO;

import java.util.ArrayList;
import java.util.List;

/**
 * @Date 10:52 2023/5/26
 * @Description {
 *   模板工作项标准
 * }
 * @Author lsay
 **/
@Getter
@AllArgsConstructor
public enum TemplateContentStandardEnum {

	NATIONAL(1, "国标"),

	TWY(2, "梯无忧"),

	CUSTOM(3, "自定义");

	final int status;

	final String name;

	/**
	 * 根据status获取枚举name值
	 * @param status 枚举status
	 * @return name值
	 */
	public static String getName(Integer status){
		if (status == null) {
			return null;
		}

		TemplateContentStandardEnum[] values = TemplateContentStandardEnum.values();
		for(TemplateContentStandardEnum statusEnum :values){
			Integer enumStatus = statusEnum.getStatus();
			if(enumStatus.equals(status)){
				return statusEnum.getName();
			}
		}
		return null;
	}

	/**
	 * 获取集合
	 * @return
	 */
	public static List<TaskStatusVO> getStandard() {
		List<TaskStatusVO> list = new ArrayList<>();
		TemplateContentStandardEnum[] taskStatuses = TemplateContentStandardEnum.values();
		for (TemplateContentStandardEnum task : taskStatuses) {
			TaskStatusVO taskStatus = new TaskStatusVO();
			taskStatus.setStatus(task.getStatus());
			taskStatus.setName(task.getName());
			list.add(taskStatus);
		}
		return list;
	}

}
